using AvaloniaApplication1.Models;
using AvaloniaApplication1.Models.DTOModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using SukiUI.Dialogs;

namespace AvaloniaApplication1.ViewModels.CardViewModel;

public partial class AddDeviceDialogViewModel : ObservableObject
{
    [ObservableProperty]
    private ISukiDialogManager _dialogManager;
    [ObservableProperty]
    private MqttCardModel _mqttCardModel;

    public AddDeviceDialogViewModel(ISukiDialogManager dialogManager, MqttCardModel mqttCardModel)
    {
        // Dialog对话框管理器
        DialogManager = dialogManager;
        MqttCardModel = mqttCardModel;
        // 确保至少有一个空的 topic 配置项供用户编辑
        if (MqttCardModel.Topics.Count == 0)
        {
            MqttCardModel.Topics.Add(new MqttTopicConfig("", 0, true, false));
        }
    }
    
  
}